package com.hnevc.anroiduiclassone5;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    Button btncharge;
    EditText etcarNumber;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btncharge=findViewById(R.id.btn_charge);
       btncharge.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               etcarNumber =findViewById(R.id.et_carNumber);
               String carnumber=etcarNumber.getText().toString();
               MyDialog dialog =new MyDialog(MainActivity.this, carnumber, new MyDialog.Oncharge() {
                   @Override
                   public void updateAmount(String amount) {
                       TextView mtvAmont=findViewById(R.id.tv_message);
                       mtvAmont.setText(amount);


                   }
               });
               dialog.show();

           }
       });
    }
}
